package com.sltx.util;

import java.util.Map;

/**
 * 该函数是为了得到完成指标数据
 */
public class Add_e {

    public static Map cyzgWczb(Map m,int gjj_, int zd, int wz, int gxd_){
        try {

            double gjjNum = StringToInt.getStringToInt(m.get("gjjNum").toString());
            double zdqyNum = StringToInt.getStringToInt(m.get("zdqyNum").toString());
            double wzqyNum = StringToInt.getStringToInt(m.get("wzqyNum").toString());
            int stringToInt = 0;
            if (m.get("gxd_yjqy") != null){
                String gxd_yjqy1 = m.get("gxd_yjqy").toString();
                stringToInt += StringToInt.getStringToInt(gxd_yjqy1);
            }else {
                stringToInt += 0;
            }
            double g = gjjNum / gjj_;
            double gjj = g * 0.15;

            double z = zdqyNum / zd;
            double zdqy = z * 0.20;

            double w = wzqyNum / wz;
            double wzqy = w * 0.15;

            double d = stringToInt / gxd_;
            double gxd = g * 0.5;
            int wcmb = (int) ((gjj + zdqy + wzqy + gxd) * 100);
            // jxdf目前没有数据
            m.put("jxdf",0);
            m.put("wcmb2021",String.valueOf(wcmb) + "%");
            return m;
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }

    public static Map lhzsWczb(Map m,int gjj_,int gxd_){
        try {
            double gjjNum = StringToInt.getStringToInt(m.get("gjjNum").toString());
            double zdqyNum = StringToInt.getStringToInt(m.get("zdqyNum").toString());
            double wzqyNum = StringToInt.getStringToInt(m.get("wzqyNum").toString());
            int stringToInt = 0;
            if (m.get("gxd_yjqy") != null){
                String gxd_yjqy1 = m.get("gxd_yjqy").toString();
                stringToInt += StringToInt.getStringToInt(gxd_yjqy1);
            }else {
                stringToInt += 0;
            }
            double sum = gjjNum + zdqyNum + wzqyNum;
            double d = sum / gjj_ ;
            double gjj = d * 0.5;
            double gxd = stringToInt / gxd_ * 0.5;
            int wcmb = (int) ((gjj + gxd) * 100);
            m.put("jxdf",0);
            m.put("wcmb2021",String.valueOf(wcmb) + "%");
            return m;
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }
}
